package client;

import observer.CObserver;
import observer.CSubject;
import observer.ConcerteObserver;
import observer.ConcerteSubject;

public class ObserverMainclass {

	public ObserverMainclass() {

	}

	public void run() {
		ConcerteSubject concerteSubject = new ConcerteSubject();
		ConcerteObserver wang = new ConcerteObserver(concerteSubject);
		wang.setName("Wang");
		ConcerteObserver li = new ConcerteObserver(concerteSubject);
		li.setName("Li");
		concerteSubject.haveFinshed(true);
		concerteSubject.removeObserver(wang);
		concerteSubject.haveFinshed(true);
	}

	public void runInsideModel() {
		CSubject concerteSubject = new CSubject();
		CObserver wang = new CObserver(concerteSubject);
		wang.setName("Wang");
		CObserver li = new CObserver(concerteSubject);
		li.setName("Li");
		concerteSubject.hasFinlished();
		concerteSubject.deleteObserver(wang);
		concerteSubject.hasFinlished();
	}
}
